package com.service;


import com.dao.DeptDao;
import com.pojo.Dept;
import com.pojo.Dept;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DeptService {
    @Resource
    private DeptDao deptDao;

    //查询所有部门
    public List<Dept> queryDeptAll(int startIndex, int endIndex) {
        return deptDao.queryDeptAll(startIndex,endIndex);
    }
    // 条件查询部门
    public List<Dept> queryDeptByDeptName(String name,int startIndex,int endIndex)
    {
        return deptDao.queryDeptByDeptName(name,startIndex,endIndex );
    }

    //总数
    public int queryDeptAllCount(){
        return deptDao.queryDeptAllCount();
    }

    //增加部门
    public int addDept(Dept dept)
    {
        return deptDao.addDept(dept);
    }

    //删除部门
    public int delDept(int id)
    {
        return deptDao.delDept(id);
    }

    //修改部门
    public int updateDept(Dept dept)
    {
        return deptDao.updateDept(dept);
    }
    //通过id查询
    public Dept queryDeptByDeptId(int id) { return deptDao.queryDeptByDeptId(id);
    }
}
